﻿namespace WMS6.Web
{
    using System;
    using System.Collections.Generic;
    using WMS6.Web.EDIServiceRef;

    public class EDIServiceClientProxy : BasePage
    {
        public string ASNImportByEDI_YITAI(List<string> data, string ownerID, string vendorID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = "";
            EDIServiceClient client = new EDIServiceClient("WSHttpBinding_IEDIService");
            try
            {
                result = client.ASNImportByEDI_YITAI(data, ownerID, vendorID, pubParasInfo);
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            finally
            {
                client.Close();
            }
            return result;
        }

        public static EDIServiceClientProxy GetInstance()
        {
            return new EDIServiceClientProxy();
        }

        private PubParasInfo InitPubParasInfo()
        {
            return new PubParasInfo { UserID = base.UserInfo.UserID, UserLanguage = base.UserInfo.Preference.Lang, CurrentWH = base.UserInfo.CurrentWH };
        }

        public string OrderImportByEDI_YITAI(List<string> data, string ownerID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = "";
            EDIServiceClient client = new EDIServiceClient("WSHttpBinding_IEDIService");
            try
            {
                result = client.OrderImportByEDI_YITAI(data, ownerID, pubParasInfo);
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            finally
            {
                client.Close();
            }
            return result;
        }
    }
}

